#include "delete.h"
#include "ui_delete.h"
#include <QPainter>
extern LinkList<Node>stu;
Delete::Delete(QWidget *parent) :
    QDialog(parent),
    ui(new Ui::Delete)
{
    ui->setupUi(this);
    setWindowTitle("删除学生信息");
}

Delete::~Delete()
{
    delete ui;
}

void Delete::on_del_button_clicked()
{
    QString id = this->ui->del_id->text();
    int index=stu.FindId(id);
    if(index==0)
    {
        QMessageBox::warning(this,"警告","没有此学号的学生");
        return;
    }
    Node s;
    stu.DeleteByIndex(index,s);
    QMessageBox::warning(this,"提示","删除成功");
}

void Delete::on_del_return_button_clicked()
{
    mainWindow*mWin=new mainWindow;
    mWin->show();
    delete this;
}
void Delete::paintEvent(QPaintEvent *)
{
   QPainter p(this);//创建画家对象p
    //绘图操作
    p.drawPixmap(rect(),QPixmap(":/new/prefix1/IMG_20210819_144709.jpg"));

}

